<?php

echo '<ul id="boutton">
      <li class="bouton_gauche">';

      // r�pondre sujet

echo '<form>';


      if($infoTopic['topic_locked']<1 && ($antiup['forum_membre_id']==$_SESSION['id'] && (($antiup['post_time']+(60*60)*24)<time()) || id2level() >= MODO))
	  {

echo '<input id="newButton" type="button" value="r&eacute;pondre au sujet" onclick="GoToUrl(\'http://'.$_SERVER['SERVER_NAME'].(getLienModule($_GET["m"],"repondre") .'?type=message&fid='.$_GET['fid'].'&tid='.$_GET['tid'].'&num='.$_GET['num']).'\');
      this.parentNode.removeChild(document.getElementById(\'newButton\'));" style="cursor:pointer;"/>';
	  }

echo '</li>
      <li class="bouton_gauche">';


      // R�solu le sujet

      if(isset($_SESSION['id']) && $infoTopic['topic_resolu']==0 && $infoTopic['topic_forum_membre_id']==$_SESSION['id'] && $infoTopic['topic_locked'] < 1)
	  {

echo '<input id="newButton4" type="button" value="R&eacute;solu ?" onclick="GoToUrl(\'http://'.$_SERVER['SERVER_NAME'].(getLienModule("forum","voirmessage") .'?action=resolve_topic&tid='.$_GET['tid'].'&num='.$_GET['num']).'\');" style="cursor:pointer;"/>';
      }
	  elseif(isset($_SESSION['id']) && $infoTopic['topic_resolu']==1 && $infoTopic['topic_forum_membre_id']==$_SESSION['id'] && $infoTopic['topic_locked'] < 1)
	  {

echo '</li>
      <li class="bouton_gauche">';



      // Non r�solu le sujet

echo '<input id="newButton4" type="button" value="Non r&eacute;solu ?" onclick="GoToUrl(\'http://'.$_SERVER['SERVER_NAME'].(getLienModule("forum","voirmessage") .'?action=unresolved_topic&tid='.$_GET['tid'].'&num='.$_GET['num']).'\');" style="cursor:pointer;"/>';
      }

echo '</li>
      <li class="bouton_gauche">';


      // Suivre la discution

      if($infoTopic['topic_locked']<1)
	  {	

echo '<input class="nb5" id="newButton5" type="button" value="suivre cette discussion" onclick="Suivre('.$_GET['fid'].','.$_GET['tid'].',\''.trim($_SESSION['id']).'\');" style="cursor:pointer;"/>';
      }

echo '</li>
<li class="bouton_droite">pagination haut</li>	  </ul>
	  
	  <ul id="boutton">
      <li class="bouton_gauche">';

	  //V�rrouiller le topic

	  if(isset($_SESSION['id']) && id2level($_SESSION['id']) == ADMIN)
	  {

	  if($infoTopic['topic_locked']<1)
	  {

echo '<input id="newButton2" type="button" value="Verrouiller le topic" onclick="GoToUrl(\'http://'.$_SERVER['SERVER_NAME'].(getLienModule("forum","forum.admin") .'?action=lock_topic&tid='.$_GET['tid'].'&num='.$_GET['num']).'\');
      this.parentNode.removeChild(document.getElementById(\'newButton2\'));" style="cursor:pointer;"/>';
	  }
	  else
	  {

echo '</li>
      <li class="bouton_gauche">';



	  //D�verrouiller le topic

echo '<input id="newButton3" type="button" value="D&eacute;verrouiller le topic" onclick="GoToUrl(\'http://'.$_SERVER['SERVER_NAME'].(getLienModule("forum","forum.admin") .'?action=unlock_topic&tid='.$_GET['tid'].'&num='.$_GET['num']).'\');
      this.parentNode.removeChild(document.getElementById(\'newButton3\'));" style="cursor:pointer;"/>';
	  }
	  }

echo '</li>
      <li class="bouton_gauche">';


      // Signaler aux admins

	  if($infoTopic['topic_locked']<1)
	  {
echo '<input id="newButton6" type="button" value="Signaler ce sujet aux Administrateur" onclick="Avertir('.$_GET['fid'].','.$_GET['tid'].');" style="cursor:pointer;"/>';
      }
echo '</form>';

     if(isset($_SESSION['id']) && id2level($_SESSION['id'])>=MODO)
	 {
	 $pdo->query("SET NAMES UTF8");
	 $cat = $pdo->query("SELECT * FROM forum_categorie JOIN forum_forum ON cat_id=forum_cat_id");

	 $c = 0;
	 $selected='';
	 $optg=false;
	 if(id2level($_SESSION['id'])==MODO)
	 $auth = 'modo';
	 else
	 $auth = 'admin';


echo '</li>
	  </ul>
	  
	  <ul id="boutton">
      <li class="bouton_gauche">';

	 //*** Déplacer le topic

echo '<form method="post" action="'.getLienModule("forum","forum.".$auth).'?action=movetopic&tid='.$_GET['tid'].'&num='.$_GET['num'].'">D&eacute;placer ce topic dans : <select name="movetopic" onchange="submit(this)">'."\n";

      while($categorie = $cat->fetch(PDO::FETCH_OBJ))
	  {
	  if($c!=$categorie->cat_id)
	  {
	  if($optg==true)

echo '</optgroup>'."\n";
echo "\n".'<optgroup label="'.$categorie->cat_nom.'">'."\n";
      $optg=true;
	  $c=$categorie->cat_id;
	  }
	  $selected='';
	  if($categorie->forum_id==$_GET['fid'])
	  $selected = ' selected="selected"';

echo "\n".'<option value="'.$categorie->forum_id.'"'.$selected.'>'.$categorie->forum_name.'</option>'."\n";
      }

echo '</optgroup></select></form>'."\n";

      $query = $pdo->query("SELECT * FROM forum_automess");


echo '</li>
	  </ul>
	  
	  <ul id="boutton">
      <li class="bouton_gauche">';

		 
		 
	  //*** Auto r�ponse

echo '<form method="post" action="'.getLienModule("forum","forum.".$auth).'?action=autoreptopic&tid='.$_GET['tid'].'&num='.$_GET['num'].'">Autor&eacute;ponse de mod&eacute;ration : <select name="autorep"><optgroup label="Auto R&eacute;ponse">';

      while($data = $query->fetch(PDO::FETCH_OBJ))
	  {

echo '<option value="' . $data->automess_id . '">	' . htmlspecialchars($data->automess_titre) . '</option>';
      }

echo '</optgroup></select>

      <input type="submit" name="autoreponse" value="Poster" />
	  </form>';
	  }
	  
echo '</li>
	  </ul>';
?> 
